home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2001 Haziran
/
CHIP Haziran2001.iso
/
prog
/
share
/
04
/
setup.exe
/
MM9.Cab
/
F1489_office.runtime5.asp.9B3B646D_CB56_4EAE_BAB7_3E7E8E41A649
< prev
next >
Wrap
Text File
|
2000-08-17
|
3KB
|
132 lines
<SCRIPT runat="server" language="VBScript">
' *****************************************************************************
'
' include/office.runtime5.asp
'
' Dynamic Link runtime support for Microsoft Office.
'
' COPYRIGHT (c) 1999-2000 Adobe Systems Incorporated. All rights reserved.
'
</SCRIPT>
<SCRIPT runat="server" language="JScript">
// *****************************************************************************
// CONTENT SOURCE WRAPPER: WORD
//
// Content source wrapper for representing a Word document as a single record
// containing a field for each distinct paragraph style. The field values are
// the concatenation of all paragraphs of that style.
//
// Items are accessed through the wrapper as follows:
//
// set word = Server.CreateObject("Word.Application")
// set document = word.Documents.Open(Server.MapPath("word.doc"))
// set results = WrapWordDoc(document)
// results.Value("Heading1")
function WrapWordDoc(wordDoc)
{
return new CSWWordDoc(wordDoc);
}
function CSWWordDoc(wordDoc)
{
// Method table:
this.Move = CSW_NOP;
this.MoveFirst = CSW_NOP;
this.MoveNext = CSW_NOP;
this.Value = CSWWordDoc_Value;
this.Set = CSW_NOP;
this.UpdateBatch = CSW_NOP;
this.Data = new Object;
for (var i = 1; i <= wordDoc.Paragraphs.Count; i++) {
var p = wordDoc.Paragraphs.Item(i);
if (typeof(this.Data[p.Style]) == "undefined") {
this.Data[p.Style] = p.Range;
} else {
this.Data[p.Style] += p.Range;
}
}
this.RecordCount = 1;
this.AbsolutePosition = 1;
this.EOF = true;
}
// -----------------------------------------------------------------------------
// Methods:
function CSWWordDoc_Value(fieldName)
{
return this.Data[fieldName];
}
// *****************************************************************************
// CONTENT SOURCE WRAPPER: EXCEL
//
// Content source wrapper for representing an Excel worksheet as a record set
// containing a record for each row comprising a field for each column. The
// first row is assumed to contain the column names.
//
// Items are accessed through the wrapper as follows:
//
// set xl = Server.CreateObject("Excel.Application")
// set workbook = xl.Workbooks.Open(Server.MapPath("sheet.xls"))
// set sheet = workbook.Worksheets(1)
// set results = WrapExcelSheet(sheet)
// results.MoveFirst
// results.Value("MSRP")
function WrapExcelSheet(xlSheet)
{
return new CSWExcelSheet(xlSheet);
}
function CSWExcelSheet(xlSheet)
{
// Method table:
this.Move = CSW_Move;
this.MoveFirst = CSW_MoveFirst;
this.MoveNext = CSW_MoveNext;
this.Value = CSWExcelSheet_Value;
this.Set = CSW_NOP;
this.UpdateBatch = CSW_NOP;
this.Data = xlSheet;
this.FieldMap = new Object;
var i = 1;
while (typeof(xlSheet.Cells(1, i).Value) != "undefined") {
this.FieldMap[xlSheet.Cells(1, i).Value] = i;
i++;
}
this.RecordCount = 0;
while (typeof(xlSheet.Cells(this.RecordCount+2, 1).Value) != "undefined") {
this.RecordCount++;
}
this.MoveFirst();
}
// -----------------------------------------------------------------------------
// Methods:
function CSWExcelSheet_Value(fieldName)
{
var rowIndex = this.AbsolutePosition + 1; // add 1 for column names
var colIndex = this.FieldMap[fieldName];
return this.Data.Cells(rowIndex, colIndex).Value;
}
</SCRIPT>